﻿<UserControl x:Class="Mnk.TBox.Core.Application.Forms.PluginsSettings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:loc="clr-namespace:Mnk.TBox.Core.Application.Code.Localization"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:my="clr-namespace:Mnk.Library.WpfControls.Components;assembly=Mnk.Library.WPFControls"
             xmlns:units="clr-namespace:Mnk.Library.WpfControls.Components.Units;assembly=Mnk.Library.WPFControls"
             xmlns:objects="clr-namespace:Mnk.TBox.Core.Application.Code.Objects" 
             xmlns:settings2="clr-namespace:Mnk.TBox.Core.Application.Code.Shelduler.Settings"
             xmlns:settings="clr-namespace:Mnk.TBox.Core.Application.Code.FastStart.Settings" xmlns:TBox="clr-namespace:Mnk.TBox.Core.Application.Properties"
             xmlns:captioned2="clr-namespace:Mnk.Library.WpfControls.Components.Captioned;assembly=Mnk.Library.WPFControls"
             xmlns:autoUpdate="clr-namespace:Mnk.Library.Common.AutoUpdate;assembly=Mnk.Library.Common"
             xmlns:settings1="clr-namespace:Mnk.TBox.Core.Application.Code.HotKeys.Settings"
             d:DesignHeight="400" d:DesignWidth="500">
    <TabControl >
        <TabItem Header="{loc:Tr TabsEnabledPlugins}">
            <DockPanel>
                <my:PanelToICheckable Name="PanelButtons" PanelHorizontalAlignment="Left" DockPanel.Dock="Bottom"/>
                <my:CheckableListBox AllowDrop="False" Name="Panel" Margin="5,0,5,5" HorizontalContentAlignment="Left" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
                    <my:CheckableListBox.ItemTemplate>
                        <DataTemplate DataType="{x:Type objects:EnginePluginInfo}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="20"/>
                                    <ColumnDefinition Width="32"/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <my:ExtCheckBox IsChecked="{Binding IsChecked}" VerticalAlignment="Center"  ValueChanged="OnCheckChangedEvent" Grid.RowSpan="2"/>
                                <Image Source="{Binding Path=ImageSource, Mode=OneTime}" Width="32" Height="32" Grid.Column="1" Grid.RowSpan="2"/>
                                <TextBlock Text="{Binding Name}" Padding="0" FontWeight="Bold" Grid.Column="2"/>
                                <TextBlock   Text="{Binding Description}" Padding="0" FontWeight="Light" TextWrapping="Wrap" Grid.Column="2" Grid.Row="1"/>
                            </Grid>
                        </DataTemplate>
                    </my:CheckableListBox.ItemTemplate>
                </my:CheckableListBox>
            </DockPanel>
        </TabItem>
        <TabItem Header="{loc:Tr GlobalSettings}">
            <ScrollViewer >
                <StackPanel HorizontalAlignment="Center" >
                    <GroupBox Header="{loc:Tr AutoUpdate}" Margin="5" Padding="5">
                        <StackPanel HorizontalAlignment="Center">
                            <StackPanel Orientation="Horizontal">
                                <captioned2:CaptionedEnumDropDownList Caption="{loc:Tr UpdateInterval}" Margin="5" Value="{Binding Update.Interval}" SourceEnumType="autoUpdate:UpdateInterval" />
                                <Button Content="{loc:Tr CheckForUpdates}" Margin="5" Width="140" Click="Button_Click" VerticalAlignment="Center"/>
                            </StackPanel>
                            <CheckBox IsChecked="{Binding Update.ShowChanglog}" Content="{loc:Tr ShowChangelogOnUpdate}" Margin="5"/>
                        </StackPanel>
                    </GroupBox>
                    <GroupBox Header="{loc:Tr FastStart}" Margin="5" Padding="5">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                            <captioned2:CaptionedNumericUpDown Caption="{loc:Tr MaxItemsInHistory}" Minimum="0" Maximum="100" Value="{Binding FastStartConfig.MaxCount}" />
                            <Button Content="{loc:Tr ClearHistory}" Margin="20 5"  HorizontalAlignment="Right" Click="ButtonClearHistoryClick" VerticalAlignment="Center"/>
                        </StackPanel>
                    </GroupBox>
                    <GroupBox Header="{loc:Tr Usability}" Margin="5" Padding="5">
                        <StackPanel>
                            <captioned2:CaptionedComboBox Name="Themes" Caption="{loc:Tr Theme}" IsEditable="False" Value="{Binding Theme}" SelectedIndexChanged="ThemeChanged"/>
                            <CheckBox IsChecked="{Binding UseMenuWithIcons}" Content="{loc:Tr UseTrayMenuWithIcons}" Margin="5"/>
                            <CheckBox IsChecked="{Binding HideOnSave}" Content="{loc:Tr HideOnSave}" Margin="5"/>
                            <CheckBox IsChecked="{Binding HideOnCancel}" Content="{loc:Tr HideOnCancel}" Margin="5"/>
                            <CheckBox IsChecked="{Binding StartHidden}" Content="{loc:Tr StartHidden}" Margin="5"/>
                            <CheckBox IsChecked="{Binding ShowSettingsByTraySingleClick}" Content="{loc:Tr ShowSettingsBySingleClickOnTrayIcon}" Margin="5"/>
                            <my:ExtCheckBox IsChecked="{Binding EnableGPUAccelerationForUi}" Content="{loc:Tr UseGPUForUIRender}" Margin="5" />
                        </StackPanel>
                    </GroupBox>
                    <GroupBox Header="{loc:Tr Shortcuts}" Margin="5" Padding="5">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                            <Button Content="{loc:Tr ShortcutToDesktop}" Click="ShortcutToDesktopClick" Margin="5"/>
                            <Button Content="{loc:Tr ShortcutToAutorun}" Click="ShortcutToAutorunClick" Margin="5"/>
                        </StackPanel>
                    </GroupBox>
                    <GroupBox  Header="{loc:Tr Configuration}" Margin="5" Padding="5">
                        <StackPanel>
                            <captioned2:CaptionedComboBox Name="cbLanguage" IsEditable="false" Caption="{loc:Tr Language}" Value="{Binding Language}" ValueChanged="LanguageChanged" Margin="5"/>
                            <CheckBox IsChecked="{Binding Configuration.PortableMode}" Content="{loc:Tr PortableMode}" Margin="5"/>
                            <TextBlock Text="{loc:Tr RestartNeeded}" FontWeight="Light" HorizontalAlignment="Right"/>
                        </StackPanel>
                    </GroupBox>
                </StackPanel>
            </ScrollViewer>
        </TabItem>
        <TabItem Header="{loc:Tr HotKeys}">
            <DockPanel>
                <my:ExtCheckBox Content="{loc:Tr GlobalHotKeysAreEnabled}" Name="HotkeysEnabled" Checked="HotkeysEnabledChecked" IsChecked="{Binding HotKeys.IsEnabled}" DockPanel.Dock="Top" Margin="5"/>
                <units:CheckableListBoxUnit Name="HotKeysView" IsEnabled="{Binding ElementName=HotkeysEnabled, Path=IsChecked}" Margin="10,2,2,2">
                    <units:CheckableListBoxUnit.ItemTemplate>
                        <DataTemplate DataType="settings1:HotkeyTask">
                            <StackPanel Margin="2">
                                <DockPanel HorizontalAlignment="Stretch" Margin="1">
                                    <my:ExtCheckBox IsChecked="{Binding IsChecked}" ValueChanged="ScheldulerCheckChanged" VerticalAlignment="Center"/>
                                    <Button Content="x" Click="ButtonClearHotkeyClick" Margin="2" Padding="2 0" DockPanel.Dock="Right" IsEnabled="{Binding IsChecked}" VerticalAlignment="Center"/>
                                    <my:HotkeyBox GlobalHotkey="{Binding HotKey}" Width="128" Margin="2" Padding="2" DockPanel.Dock="Right" IsEnabled="{Binding IsChecked}" VerticalAlignment="Center"/>
                                    <TextBlock Text="{Binding}" FontWeight="Bold" Padding="0" Margin="2" VerticalAlignment="Center" />
                                </DockPanel>
                            </StackPanel>
                        </DataTemplate>
                    </units:CheckableListBoxUnit.ItemTemplate>
                </units:CheckableListBoxUnit>
            </DockPanel>
        </TabItem>
        <TabItem Header="{loc:Tr Scheduler}">
            <DockPanel>
                <my:ExtCheckBox Content="{loc:Tr ScheldulerIsEnabled}" Name="SchedulerEnabled" Checked="SheldulerEnabledChecked" IsChecked="{Binding SchedulerTasks.IsEnabled}" DockPanel.Dock="Top" Margin="5"/>
                <units:CheckableListBoxUnit Name="ScheldulerView" IsEnabled="{Binding ElementName=SchedulerEnabled, Path=IsChecked}" SmoothScrolling="True" Margin="10,2,2,2">
                    <units:CheckableListBoxUnit.ItemTemplate>
                        <DataTemplate DataType="settings2:SchedulerTask">
                            <StackPanel Margin="2">
                                <DockPanel HorizontalAlignment="Stretch" Margin="1">
                                    <my:ExtCheckBox IsChecked="{Binding IsChecked}" ValueChanged="ScheldulerCheckChanged" VerticalAlignment="Center"/>
                                    <TextBlock Text="{Binding}" FontWeight="Bold" Padding="0" Margin="2" VerticalAlignment="Center"/>
                                </DockPanel>
                                <StackPanel Orientation="Horizontal">
                                    <my:FlagsCheckBoxes BaseType="{x:Type settings2:ShortDayOfWeek}" Caption="{loc:Tr DayOfTheWeek}" Orientation="Horizontal" Value="{Binding DaysOfWeek}" IsEnabled="{Binding IsChecked}"/>
                                    <captioned2:CaptionedTimeBox Caption="{loc:Tr DayTime}" Value="{Binding TimeOfTheDay, Mode=TwoWay}" IsEnabled="{Binding IsChecked}" Margin="2" VerticalAlignment="Center"/>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </units:CheckableListBoxUnit.ItemTemplate>
                </units:CheckableListBoxUnit>
            </DockPanel>
        </TabItem>
        <TabItem Header="{loc:Tr UserActions}">
            <DockPanel>
                <units:CheckableListBoxUnit Name="UserActionsView" UnitType="Text" Title="{loc:Tr ConfigureUserAction}">
                    <units:CheckableListBoxUnit.ItemTemplate>
                        <DataTemplate DataType="{x:Type settings:MenuItemsSequence}" >
                            <DockPanel>
                                <Button Content="..." VerticalAlignment="Center" Width="32" Margin="2" Click="BtnEditUserActionClick" DockPanel.Dock="Right"  IsEnabled="{Binding IsChecked}"/>
                                <my:ExtCheckBox IsChecked="{Binding IsChecked}" ValueChanged="UserActionsCheckChanged" VerticalAlignment="Center" DockPanel.Dock="Left"/>
                                <TextBlock Text="{Binding Key}" Padding="0" Margin="2" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
                            </DockPanel>
                        </DataTemplate>
                    </units:CheckableListBoxUnit.ItemTemplate>
                </units:CheckableListBoxUnit>
            </DockPanel>
        </TabItem>
        <TabItem Header="{loc:Tr Configuration}" >
            <DockPanel>
                <GroupBox  Header="{loc:Tr Aliases}" >
                    <units:CheckableListBoxUnit Name="Aliases" ItemsSource="{Binding Configuration.Aliases}" UnitType="Text" Title="{loc:Tr ConfigureAlias}">
                        <units:CheckableListBoxUnit.ItemTemplate>
                            <DataTemplate>
                                <DockPanel>
                                    <my:ExtCheckBox IsChecked="{Binding IsChecked}" ValueChanged="AliasesCheckChanged" VerticalAlignment="Top" DockPanel.Dock="Left" Margin="2"/>
                                    <StackPanel HorizontalAlignment="Stretch">
                                        <TextBlock Text="{Binding Key}" FontWeight="Bold" Padding="0" Margin="2" TextTrimming="CharacterEllipsis"/>
                                        <TextBox Text="{Binding Value}" Padding="0" Margin="2"  IsEnabled="{Binding IsChecked}" />
                                    </StackPanel>
                                </DockPanel>
                            </DataTemplate>
                        </units:CheckableListBoxUnit.ItemTemplate>
                    </units:CheckableListBoxUnit>
                </GroupBox>
            </DockPanel>
        </TabItem>
    </TabControl>
</UserControl>
